package dk.modified.reshary;

import java.util.Map;

public class ViewShareController {

	public static Boolean isMailApproved(Map<String, String> response) {
		if (response.containsKey("mailapproved")) {
			int emailvalidated = Integer.parseInt(response.get("mailapproved"));
			if (emailvalidated == 1) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public static Boolean isFilenameSet(Map<String, String> response) {

		if (response.containsKey("filename")) {
			return true;
		} else {
			return false;
		}
	}

	public static Boolean isUsertokenValid(Map<String, String> response) {

		if (response.containsKey("error")) {
			if (response.get("error").equals("Invalid securitytoken")) {
				return false;
			} else {
				return true;
			}
		} else {
			return true;
		}
	}

	public static Boolean isError(Map<String, String> response) {
		if (response.containsKey("status")) {
			if (response.get("status").equals("failure"))
				return true;
			else
				return false;

		} else
			return false;
	}

}
